package com.daoxuehao.baseframework.app;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.daoxuehao.baseframework.module.IPresenter;

/**
 * Created by Yale on 2016/3/28.
 */
public abstract class BaseActivity extends AppCompatActivity {

    private IPresenter mIPresenter;

    @Override
    protected void onCreate( Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mIPresenter = initPresenter();
    }

    protected abstract IPresenter initPresenter();

    @Override
    protected void onDestroy() {

        if (mIPresenter!=null){
            mIPresenter.detachView();
        }
        super.onDestroy();
    }
}
